[SUBROUTINE]
version = 1.14
icon = probe-edge.png
name = _("Probe Edges")
type = probe-edge
help = _("<b>Probe Edges with touch-off options</b>&#10;When done, the probe will be above the edge")
order = act h1 axis dir clr touch

[PARAM_ACT]
name = _("Active")
icon = enable.png
type = bool
icon = enable.png
value = 1

[PARAM_H1]
name = _("Options")
type = sub-header

[PARAM_AXIS]
name = _("Axis")
type = combo
options = _("X=0:Y=1")
icon = xy-axes.png
tool_tip = _("Select axis to find edge")
value = 0
header = h1

[PARAM_DIR]
name = _("Direction")
type = combo
options = _("Ascending=1:Descending=-1")
icon = sel+-.png
value = 1
header = h1

[PARAM_CLR]
name = _("Clear Z")
type = float
minimum_value = 0.0
icon = safe-z-rel.png
tool_tip = _("To raise above workpiece")
value = 0.5
metric_value = 12
header = h1

[PARAM_TOUCH]
name = _("Touch off axis")
type = bool
icon = touch-off.png
tool_tip = _("Set axis to 0")
value = 1
header = h1

[DEFINITIONS]
content = 
;	<eval>self.include_once("probe.ngc")</eval>

[CALL]
content = 
	(begin #sub_name)
	(probe edge author : Fernand Veilleux)
	
	o<#self_id_ena> if [#param_act]
		#<temp_z#ID> = #<_z>
		
		o<#self_id_X> if [#param_axis EQ 0]
			o<probe> call [#param_dir] [0] [0]
			o<#self_id_Xup> if [#param_dir GT 0]
				#<x#ID> = [#5061 + #<_probe_tip_dia> / 2]
				G0 X[#5061 - #<_probe_tip_dia>]
			o<#self_id_Xup> else
				#<x#ID> = [#5061 - #<_probe_tip_dia> / 2]
				G0 X[#5061 + #<_probe_tip_dia>]
			o<#self_id_Xup> endif	
			G0 Z[#<temp_z#ID> + #param_clr]
			G0 X[#<x#ID>]
			o<#self_id_Xt> if [#param_touch]
				G10 L20 P#5220 X0
			o<#self_id_Xt> endif
		o<#self_id_X> endif
		
		o<#self_id_Y> if [#param_axis EQ 1]
			o<probe> call [0] [#param_dir] [0]
			o<#self_id_Yup> if [#param_dir GT 0]
				#<y#ID> = [#5062 + #<_probe_tip_dia> / 2]
				G0 Y[#5062 - #<_probe_tip_dia>]
			o<#self_id_Yup> else
				#<y#ID> = [#5062 - #<_probe_tip_dia> / 2]
				G0 Y[#5062 + #<_probe_tip_dia>]
			o<#self_id_Yup> endif
			G0 Z[#<temp_z#ID> + #param_clr]
			G0 Y[#<y#ID>]
		
			o<#self_id_Yt> if [#param_touch]
				G10 L20 P#5220 Y0
			o<#self_id_Yt> endif
		o<#self_id_Y> endif
		
	o<#self_id_ena> endif
	(end #sub_name)
